/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.gov.igac.observatorio.entidades.propuesta;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author bigbang
 */
@Entity
@Table(name = "vinculo")
@NamedQueries({
    @NamedQuery(name = "Vinculo.findAll", query = "SELECT v FROM Vinculo v"),
    @NamedQuery(name = "Vinculo.findByIdVinculo", query = "SELECT v FROM Vinculo v WHERE v.idVinculo = :idVinculo"),
    @NamedQuery(name = "Vinculo.findByTipoVinculo", query = "SELECT v FROM Vinculo v WHERE v.tipoVinculo = :tipoVinculo")})
public class Vinculo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idVinculo")
    private Integer idVinculo;
    @Size(max = 45)
    @Column(name = "tipoVinculo")
    private String tipoVinculo;
    @OneToMany(mappedBy = "vinculo")
    private List<Participante> participanteList;

    public Vinculo() {
    }

    public Vinculo(Integer idVinculo) {
        this.idVinculo = idVinculo;
    }

    public Integer getIdVinculo() {
        return idVinculo;
    }

    public void setIdVinculo(Integer idVinculo) {
        this.idVinculo = idVinculo;
    }

    public String getTipoVinculo() {
        return tipoVinculo;
    }

    public void setTipoVinculo(String tipoVinculo) {
        this.tipoVinculo = tipoVinculo;
    }

    public List<Participante> getParticipanteList() {
        return participanteList;
    }

    public void setParticipanteList(List<Participante> participanteList) {
        this.participanteList = participanteList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idVinculo != null ? idVinculo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vinculo)) {
            return false;
        }
        Vinculo other = (Vinculo) object;
        if ((this.idVinculo == null && other.idVinculo != null) || (this.idVinculo != null && !this.idVinculo.equals(other.idVinculo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.getTipoVinculo();
    }
    
}
